import 'package:demo/utils/sp_util.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'package:get/get.dart';

import '../../../../theme/app_colors.dart';
import '../../../../theme/app_text_theme.dart';
import 'mine_controller.dart';

class MineView extends GetView<MineController> {
  const MineView({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: const Color(0xfff2f6ff),
      body: Stack(
        children: [
          Image.asset("assets/images/ic_mine_top.png", width: context.width, height: context.width * 441 / 750),
          Column(
            children: [
              Container(
                margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top),
                height: AppBar().preferredSize.height,
                child: Stack(
                    children: [
                      Center(child: Text('我的', style: text_title_white)),
                      Positioned(
                        right: 15.w,
                        top: 0,
                        bottom: 0,
                        child: Row(children: [
                          InkWell(
                              onTap: () => controller.call(),
                              child: Image.asset("assets/images/ic_service.png", width: 20.w, height: 20.w,color: Color_white))
                        ]),
                      )
                    ]
                ),
              ),
              SizedBox(height: 10.w),
              Expanded(
                child: SingleChildScrollView(
                  child: Column(
                    children: [
                      Row(
                          children: [
                            SizedBox(width: 15.w),
                            ClipRRect(
                                borderRadius: BorderRadius.circular(25.w),
                                child: Image.asset("assets/images/ic_launcher.png", width: 50.w, height: 50.w)
                            ),
                            SizedBox(width: 10.w),
                            Text(SpUtil.read(SpUtil.PHONE, ''),style: text_white_16)
                          ]
                      ),
                      SizedBox(height: 15.w),
                      Container(
                        margin: EdgeInsets.symmetric(horizontal: 15.w),
                        padding: EdgeInsets.symmetric(horizontal: 15.w,vertical: 15.w),
                        decoration: BoxDecoration(
                          color: Color_white,
                          borderRadius: BorderRadius.all(Radius.circular(8.w)),
                        ),
                        child: Column(
                          crossAxisAlignment : CrossAxisAlignment.start,
                          children: [
                            Text('我的借款',style: text_131732_16),
                            SizedBox(height: 12.w),
                            Row(
                              mainAxisAlignment : MainAxisAlignment.spaceBetween,
                              children: [
                                InkWell(
                                  onTap: ()=> controller.toOrder(1),
                                  child: Column(children: [
                                    Image.asset("assets/images/ic_order1.png", width: 25.w, height: 25.w),
                                    SizedBox(height: 6.w),
                                    Text('待确认',style: text_grey_14),
                                  ]),
                                ),
                                InkWell(
                                  onTap: ()=> controller.toOrder(2),
                                  child: Column(children: [
                                    Image.asset("assets/images/ic_order2.png", width: 25.w, height: 25.w),
                                    SizedBox(height: 6.w),
                                    Text('待还款',style: text_grey_14),
                                  ]),
                                ),
                                InkWell(
                                  onTap: ()=> controller.toOrder(3),
                                  child: Column(children: [
                                    Image.asset("assets/images/ic_order3.png", width: 25.w, height: 25.w),
                                    SizedBox(height: 6.w),
                                    Text('已逾期',style: text_grey_14),
                                  ]),
                                ),
                                InkWell(
                                  onTap: ()=> controller.toOrder(4),
                                  child: Column(children: [
                                    Image.asset("assets/images/ic_order4.png", width: 25.w, height: 25.w),
                                    SizedBox(height: 6.w),
                                    Text('审核中',style: text_grey_14),
                                  ]),
                                ),
                                InkWell(
                                  onTap: ()=> controller.toOrder(0),
                                  child: Column(children: [
                                    Image.asset("assets/images/ic_order5.png", width: 25.w, height: 25.w),
                                    SizedBox(height: 6.w),
                                    Text('全部订单',style: text_grey_14),
                                  ]),
                                )
                              ],
                            )
                          ],
                        ),
                      ),
                      SizedBox(height: 15.w),
                      Container(
                          margin: EdgeInsets.symmetric(horizontal: 15.w),
                          child: InkWell(
                              onTap: ()=> controller.apply(),
                              child: Image.asset("assets/images/ic_banner.png", width: context.width-30.w, height: (context.width-30.w) * 256 / 700))),
                      SizedBox(height: 15.w),
                      InkWell(
                        onTap: () => controller.toAgreementCenter(),
                        child: Container(
                          height: 45.w,
                          padding: EdgeInsets.symmetric(horizontal: 15.w),
                          child: Row(children: [
                            Image.asset("assets/images/ic_agreement.png", width: 25.w, height: 25.w),
                            SizedBox(width: 9.w),
                            Text('协议中心',style: text_131732_14)
                          ]),
                        ),
                      ),
                      Container(height: 0.2,color: Color_line),
                      InkWell(
                        onTap: ()=> controller.toBackFeed(),
                        child: Container(
                          height: 45.w,
                          padding: EdgeInsets.symmetric(horizontal: 15.w),
                          child: Row(children: [
                            Image.asset("assets/images/ic_feedback.png", width: 25.w, height: 25.w),
                            SizedBox(width: 9.w),
                            Text('反馈建议',style: text_131732_14)
                          ]),
                        ),
                      ),
                      Container(height: 0.2,color: Color_line),
                      InkWell(
                        onTap: ()=> controller.toAbout(),
                        child: Container(
                          height: 45.w,
                          padding: EdgeInsets.symmetric(horizontal: 15.w),
                          child: Row(children: [
                            Image.asset("assets/images/ic_about1.png", width: 25.w, height: 25.w),
                            SizedBox(width: 9.w),
                            Text('关于我们',style: text_131732_14)
                          ]),
                        ),
                      ),
                      Container(height: 0.2,color: Color_line),
                      InkWell(
                        onTap: () => controller.call(),
                        child: Container(
                          height: 45.w,
                          padding: EdgeInsets.symmetric(horizontal: 15.w),
                          child: Row(children: [
                            Image.asset("assets/images/ic_service1.png", width: 25.w, height: 25.w),
                            SizedBox(width: 9.w),
                            Text('联系电话',style: text_131732_14)
                          ]),
                        ),
                      ),
                      Container(height: 0.2,color: Color_line),
                      InkWell(
                        onTap: () => controller.toCancel(),
                        child: Container(
                          height: 45.w,
                          padding: EdgeInsets.symmetric(horizontal: 15.w),
                          child: Row(children: [
                            Image.asset("assets/images/ic_cancel.png", width: 25.w, height: 25.w),
                            SizedBox(width: 9.w),
                            Text('注销账号',style: text_131732_14)
                          ]),
                        ),
                      ),
                      Container(height: 0.2,color: Color_line),
                      SizedBox(height: 30.w),
                      InkWell(
                        onTap: () => controller.logout(),
                        child: Container(
                          width: context.width - 30.w,
                          height: 45.w,
                          margin: EdgeInsets.symmetric(horizontal: 15.w),
                          decoration: BoxDecoration(
                            border: Border.all(color: Color_grey, width: 0.5),
                            borderRadius: BorderRadius.all(Radius.circular(8.w)),
                          ),
                          child: Center(child: Text('退出登录',style: text_131732_16)),
                        ),
                      ),
                      SizedBox(height: 30.w),
                    ],
                  ),
                ),
              )
            ],
          )
        ],
      ),
    );
  }
}